package com.koron.common.core.business.workflow.bean.param;

import com.koron.common.core.business.workflow.util.TextUtil;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 工作流提交参数封装对象
 *
 * @author mwangli
 * @date 2021/1/27 16:08
 **/
@Data
public class SubmitParam {

    public SubmitParam(){}

    public SubmitParam baseParam(BaseParam baseParam) {
        this.secret = baseParam.getSecret();
        this.setCode = baseParam.getSetCode();
        this.processCode = baseParam.getProcessCode();
        return this;
    }

    public SubmitParam billId(String billId) {
        this.billId = billId;
        return this;
    }

    public SubmitParam operator(String operator) {
        this.operator = operator;
        return this;
    }

    public SubmitParam taskId(String taskId) {
        this.taskId = taskId;
        return this;
    }

    public SubmitParam formVariables(String formVariables) {
        this.formVariables = TextUtil.toMapFromString(formVariables);
        return this;
    }

    /**
     * RSA密钥
     */
    private String secret;

    /**
     * 模板组编号
     */
    private String setCode;

    /**
     * 模板编号
     */
    private String processCode;

    /**
     * 业务单号
     */
    private String billId;

    /**
     * 操作人
     */
    private String operator;

    /**
     * 任务ID
     */
    private String taskId;

    /**
     * 备注
     */
    private String comment;

    /**
     * 操作
     * 1驳回、2转办、4添加沟通人、8催办、16废弃、32通过、64回复沟通、128取消沟通，256撤回
     */
    private Integer operation;

    /**
     * 驳回节点编号
     */
    private String rejectNodeCode;

    /**
     * 驳回之后是否提交到当前节点 1 是  (0 或者 null) 否
     */
    private Integer rejectType;

    /**
     * 关联用户
     */
    private String relatedUser;

    /**
     * 其他节点处理人
     */
    private String otherNodeCandidates;

    /**
     * 附件标识
     */
    private String attachment;

    /**
     * 表单变量对象
     */
    private Map<String,String> formVariables = new HashMap<>();

    /*
     * 下一个节点
     */
    private String artificialDecisionCondition;

}
